// 导入 express
const express = require("express")
const expressJOI = require("@escook/express-joi")
const { add_cate_schema } = require("../schema/artcate")
// 创建路由对象
const router = express.Router()
const {
  getArticleCate,
  insertArticleCate,
  deleteArticleCate,
  getArticleCateDetail,
  updateCate,
} = require("../router_handler/art_cate")

// 获取文章分类的列表数据
router.get("/cates", getArticleCate)

// 定义新增文章的路由

router.post("/addcates", expressJOI(add_cate_schema), insertArticleCate)

// 定义删除路由
router.get("/deletecate/:id", deleteArticleCate)

// 定义获取分类详情的路由

router.get("/cates/:id", getArticleCateDetail)

// 定义更新路由

router.post("/updatecate", updateCate)

// 向外共享路由对象
module.exports = router
